package control.panel
{
	import view.panel.prompt.AlertYesNoPanel;
	import view.panel.prompt.msg.IPromptMsg;

	public class AlertYesNoPanelControl extends PanelControl
	{
		private var currentMsg:IPromptMsg;
		
		public function AlertYesNoPanelControl()
		{
			initPanel();
		}
			
		private function initPanel():void
		{
			_view.alertYesNoPanel = new AlertYesNoPanel(this);
		}
		
		public function open(msg:IPromptMsg):void
		{
			currentMsg = msg;
			_view.alertYesNoPanel.alertBut(msg.content);
			_view.alertYesNoPanel.open();
			_control.sceneControl.lockWorld();
		}
		
		public function onYes():void
		{
			currentMsg.onYes();
			_view.alertYesNoPanel.close();
			_control.sceneControl.unlockWorld();
		}
		
		public function onNo():void
		{
			currentMsg.onNo();
			_view.alertYesNoPanel.close();
			_control.sceneControl.unlockWorld();
		}
	}
}